<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%--
  Created by IntelliJ IDEA.
  User: 王晓阳
  Date: 2024/4/18
  Time: 16:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <script src="webjars/layui/2.6.8/layui.js"></script>
    <link rel="stylesheet" href="webjars/layui/2.6.8/css/layui.css" media="all">
</head>
<body>
    <div class="layui-container">
        <table id="plotTable" lay-filter="plotTables"  class="layui-table layui-table-hover"></table>
    </div>
    <%--头部工具栏，添加--%>
    <script type="text/html" id="headTool">
        <button class="layui-btn">巡检明细</button>
    </script>
    <script>
        let $=layui.$

        //渲染表格
        layui.use(function (){
            let table=layui.table;
            table.render({
                id:"one",
                elem:"#plotTable",
                page : true,
                limit : 5,
                limits : [5,10,15,20],
                method : "post",
                contentType : "application/json",
                url:"/Site/Detail/show",
                toolbar: "#headTool",
                cols:[[
                    {field:'number',align: 'center',type:'numbers',title:"编号"},
                    {field:'id',align: 'center',hide:true,title:"巡查编号"},
                    {field:'sitepoint',align: 'center',title:"巡检点名称",templet(d){
                        return d.sitepoint.pointname == null ? "-" : d.sitepoint.pointname;
                    }},
                    {field:'siteproject',align: 'center',title:"巡检计划名称",templet(d){
                        return d.siteproject.projectname == null ? "-" : d.siteproject.projectname;
                    }},
                    {field:'siteroute',align: 'center',title:"巡检路线名称",templet(d){
                        return d.siteroute.routename == null ? "-" : d.siteroute.routename;
                    }},
                    {field:'siteproject',align: 'center',title:"巡检人开始/结束时间",templet(d){
                        return d.siteproject.timeradius == null ? "-" : d.siteproject.timeradius;
                    }},
                    {field:'sitepoint',align: 'center',title:"实际巡检时间",templet(d){
                        return d.sitepoint.realsitetime == null ? "-" : d.sitepoint.realsitetime;
                    }},
                    {field:'siteproject',align: 'center',title:"巡检人",templet(d){
                        return d.siteproject.user.username == null ? "-" : d.siteproject.user.username;
                    }},
                    {field:'siteproject',align: 'center',title:"巡检方式",templet(d){
                        return d.siteproject.signtype == 1 ? "现场拍照" : "现场定位";
                    }},
                    {field:'sitepoint',align: 'center',title:"巡检点状态",templet(d){
                        return d.sitepoint.sitetypes.typename == null ? "-" : d.sitepoint.sitetypes.typename;
                    }},
                    {field:'sitepoint',align: 'center',title:"巡检情况",templet(d){
                        return d.sitepoint.note == null ? "-" : d.sitepoint.note;
                    }},
                    {field:'siteproject',align: 'center',title:"创建时间",templet(d){
                        return d.siteproject.settime == null ? "-" : d.siteproject.settime;
                    }},
                    {fixed: 'right',field:'sitepoint',align: 'center',title:"巡检位置",templet(d){
                        return d.sitepoint.siteposition == null ? "-" : d.sitepoint.siteposition;
                    }}
                ]]
            })

        })
    </script>
</body>
</html>
